package com.sc.common.exception;

import com.sc.common.domain.Result;
import com.sc.common.enums.HttpCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result exception(Exception ex) {
        log.info("初始化请求异常处理器....");
        ex.printStackTrace();
        return Result.error(HttpCodeEnum.SERVER_ERROR, "操作失败,请联系管理员");
    }
}
